Conversation
sumitmsft
reviewed
Aug 25, 2025
sumitmsft
requested changes
Aug 25, 2025
Contributor
sumitmsft
left a comment
There was a problem hiding this comment.
Left a comment. Rest all looks good
sumitmsft
approved these changes
Sep 15, 2025
sumitmsft
previously approved these changes
Sep 16, 2025
Contributor
There was a problem hiding this comment.
Pull Request Overview
This pull request adds query timeout functionality to the MSSQL Python driver, allowing users to set timeout values at the connection level that apply to all cursors created from that connection.
- Added timeout parameter to Connection class and connect function with proper validation
- Implemented timeout enforcement in cursor execute/executemany methods using SQL_ATTR_QUERY_TIMEOUT
- Exposed necessary C++ driver bindings for setting statement attributes
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| mssql_python/db_connection.py | Added timeout parameter to connect function |
| mssql_python/connection.py | Added timeout property with getter/setter and passed to cursor creation |
| mssql_python/cursor.py | Added timeout support in execute/executemany methods |
| mssql_python/constants.py | Added SQL_ATTR_QUERY_TIMEOUT constant |
| mssql_python/pybind/ddbc_bindings.cpp | Exposed DDBCSQLSetStmtAttr function for setting statement attributes |
| tests/test_003_connection.py | Added test imports and cleanup fixture |
| tests/test_004_cursor.py | Added comprehensive tests for decimal separator functionality |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
sumitmsft
approved these changes
Sep 18, 2025
bewithgaurav
approved these changes
Sep 18, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Work Item / Issue Reference
Summary
This pull request adds support for per-connection query timeouts to the MSSQL Python driver. Now, you can set a timeout value on a connection, either at creation or later, and all cursors created from that connection will enforce this timeout for query execution. The changes include updates to the connection and cursor classes, integration with the underlying driver, and comprehensive tests for the new functionality.
Query Timeout Support
timeoutparameter to theConnectionclass and theconnectfunction, allowing users to specify a query timeout (in seconds) when establishing a database connection. The timeout can also be set or updated via a property on theConnectionobject.timeoutproperty in theConnectionclass, including input validation and documentation. Setting the timeout updates all subsequently created cursors.cursormethod inConnectionto pass the current timeout value to each newCursorinstance.Cursorclass to accept a timeout parameter and, if set, apply it to each query execution using the underlying driver’s statement attribute API.SQL_ATTR_QUERY_TIMEOUTconstant and theDDBCSQLSetStmtAttrfunction in the C++ driver bindings to support setting the timeout at the driver level.Testing and Validation